home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / glibc.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2007-04-04  |  3.1 KB  |  102 lines

  1. #! /bin/sh -e
  2. #
  3. ### BEGIN INIT INFO
  4. # Provides:          glibc
  5. # Required-Start:
  6. # Required-Stop:
  7. # Default-Start:     S
  8. # Default-Stop:
  9. ### END INIT INFO
  10. #
  11. # This script is existed for detecting depreciated kernel version to
  12. # check glibc incompatibility.
  13.  
  14. if [ "`uname -s`" = Linux ]; then
  15.     # glibc kernel version check: KERNEL_VERSION_CHECK
  16. kernel_compare_versions () {
  17.     verA=$(($(echo "$1" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
  18.     verB=$(($(echo "$3" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
  19.     
  20.     test $verA -$2 $verB
  21. }
  22.  
  23. exit_check () {
  24.     sleep 5
  25.     exit 1
  26. }
  27.  
  28.     # Test to make sure z < 255, in x.y.z-n form of kernel version
  29.     # Also make sure we don't trip on x.y.zFOO-n form
  30.     #kernel_rev=$(uname -r | tr -- - . | cut -d. -f3 | tr -d '[:alpha:]')
  31.     kernel_rev=$(uname -r | sed 's/\([0-9]*\.[0-9]*\.\)\([0-9]*\)\(.*\)/\2/')
  32.     if [ "$kernel_rev" -ge 255 ]
  33.     then
  34.         echo WARNING: Your kernel version indicates a revision number
  35.         echo of 255 or greater.  Glibc has a number of built in
  36.         echo assumptions that this revision number is less than 255.
  37.         echo If you\'ve built your own kernel, please make sure that any 
  38.         echo custom version numbers are appended to the upstream
  39.         echo kernel number with a dash or some other delimiter.
  40.  
  41.         exit_check
  42.     fi
  43.  
  44.     # sanity checking for the appropriate kernel on each architecture.
  45.     realarch=`uname -m`
  46.     kernel_ver=`uname -r`
  47.  
  48.     # convert "armv4l" and similar to just "arm", and "mips64" and similar
  49.     # to just "mips"
  50.     case $realarch in
  51.       arm*) realarch="arm";;
  52.       mips*) realarch="mips";;
  53.     esac
  54.     
  55.  
  56.     # intel i386 requires a recent kernel
  57.     if [ "$realarch" = i386 ]
  58.     then
  59.     # From glibc 2.3.5-7 and linux-2.6 2.6.12-1, real-i386 is dropped.
  60.     #if kernel_compare_versions "$kernel_ver" lt 2.4.24
  61.     #then
  62.         echo WARNING: This machine has real i386 class processor.
  63.         echo Debian etch and later does not support such old hardware
  64.         echo any longer.
  65.         echo The reason is that \"bswap\" instruction is not supported
  66.         echo on i386 class processors, and some core libraries have 
  67.         echo such instruction.  You\'ll see illegal instruction error
  68.         echo when you upgrade your Debian system.
  69.         exit_check
  70.     #fi
  71.     fi
  72.  
  73.     # The GNU libc requires 2.6 kernel (except on m68k) because we drop to 
  74.     # support linuxthreads
  75.     if [ "$realarch" != m68k ]
  76.     then
  77.     if kernel_compare_versions "$kernel_ver" lt 2.6.0
  78.     then
  79.         echo WARNING: POSIX threads library NPTL requires 2.6 and
  80.         echo later kernel.  If you use 2.4 kernel, please upgrade your
  81.         echo kernel before installing glibc.
  82.         exit_check
  83.     fi
  84.     fi
  85.     
  86.     # The GNU libc is now built with --with-kernel= >= 2.4.1 on m68k
  87.     if [ "$realarch" = m68k ]
  88.     then
  89.     if kernel_compare_versions "$kernel_ver" lt 2.4.1
  90.     then
  91.         echo WARNING: This version of glibc requires that you be running
  92.         echo kernel version 2.4.1 or later.  Earlier kernels contained
  93.         echo bugs that may render the system unusable if a modern version
  94.         echo of glibc is installed.
  95.         exit_check
  96.     fi
  97.     fi
  98.  
  99. fi
  100.  
  101. : exit 0
  102.